#include<iostream>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_set>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<queue>
#include<climits>
#include<stack>

using namespace std;
typedef long long ll;
#define INF 1000000000.0
#define EPS 0.0000001

template<typename T> 
inline void read(T &x){
	x=0;T f=1;char ch;
	do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');
	do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

ll p[16]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53};

ll ans,n;

// d:depth of the prime
// val: num coefficient -> val
// num: num coefficient
// up: last prime's power
void dfs(ll d,ll val,ll num,ll up){
  if(num>n||d>=16||val>ans)return;
  if(num==n&&ans>val){ans=val;return;}
  for(int i=1;i<=up;i++){
    if(val>=ans/p[d])break;
    dfs(d+1,val*=p[d],num*(i+1),i);
  }
}
int main(){
    #ifdef BUG
    freopen("a.in","r",stdin);
    #endif
    //find the minimal val with n coefficient
    while(cin>>n){
      ans=LONG_LONG_MAX>>1;
      //cout<<ans<<endl;
      dfs(0,1,1,60);
      cout<<ans<<endl;
    }
}
